/**
 * 
 */
package com.fan.shop.businesslogic;

import java.util.Date;

import com.fan.shop.domain.User;
import com.fan.shop.process.ProcExec;
import com.fan.shop.services.UserService;

/**
 * @author Fan
 * 
 */
public class UserProcess extends ProcExec<Object> {

	private String username;
	private String password;
	private String password2;
	private String address;
	private String postAddress;
	private String email;
	private String phone;
	private String mobile;
	private Date registeredTime;
	private UserService userService;
	
	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getPassword2() {
		return password2;
	}

	public void setPassword2(String password2) {
		this.password2 = password2;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getPostAddress() {
		return postAddress;
	}

	public void setPostAddress(String postAddress) {
		this.postAddress = postAddress;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public Date getRegisteredTime() {
		return registeredTime;
	}

	public void setRegisteredTime(Date registeredTime) {
		this.registeredTime = registeredTime;
	}

	public UserService getUserService() {
		return userService;
	}

	public void setUserService(UserService userService) {
		this.userService = userService;
	}


	public Integer createrNewUser()
	{
		try {
			User user = new User();
			user.setUsername(username);
			user.setPassword(password);
			user.setAddress(address);
			user.setEmail(email);
			user.setMobile(mobile);
			user.setPhone(phone);
			user.setPostAddress(postAddress);
			user.setRegisteredTime(new Date(System.currentTimeMillis()));
			
			userService.addUser(user);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return -1;
		}
		return 1;
		
		
	}
	
	
	
	@Override
	public Integer processImpl() {
		
		
		
		
		return null;
	}

}
